package com.wontube.smr.remote.web;

import java.util.List;

import com.wontube.client.modle.vo.PagenateInfo;
import com.wontube.core.annotation.CacheSupport;
import com.wontube.core.annotation.NoLoginSupport;
import com.wontube.core.pub.servlet.handlers.BasicHandler;
import com.wontube.smr.dao.bo.BlogDao;
import com.wontube.smr.web.client.IBlogHandler;
import com.wontube.smr.web.client.model.po.Blog;
import com.wontube.smr.web.client.model.po.BlogCategory;
import com.wontube.smr.web.client.model.po.BlogTag;
import com.wontube.smr.web.client.model.vo.BlogItems;

/**
 * @author tanggf(2012-5-29)
 * 
 */
@NoLoginSupport
public class BlogHandler extends BasicHandler implements IBlogHandler {
	@Override
	public BlogItems listTypeBlogs(PagenateInfo pageInfo, String type, String typeName) {
		return BlogDao.listTypeBlogs(pageInfo, type, typeName);
	}

	@Override
	public List<BlogTag> listAllBlogTags(PagenateInfo pageInfo) {
		return BlogDao.listAllBlogTagsPage(pageInfo);
	}

	@Override
	public List<BlogCategory> listAllBlogCategories() {
		return BlogDao.listAllCatAndCount();
	}

	@Override
	public List<BlogTag> listAllBlogTags() {
		// TODO Auto-generated method stub
		return BlogDao.listAllBlogTagsPage();
	}

	@Override
	@CacheSupport(timeToLiveSeconds = 3600 * 12)
	public BlogItems listBlogs(PagenateInfo pageInfo) {
		return BlogDao.listReleasedBlogs(pageInfo);
	}

	@Override
	@CacheSupport(timeToLiveSeconds = 3600 * 12)
	public Blog getBlog(String urlTitle) {
		return BlogDao.getReleasedBlogDetail(urlTitle);
	}
}
